//
//  HeaderTableViewCell.m
//  TenThousand
//
//  Created by 我的 on 16/6/16.
//  Copyright © 2016年 baixue. All rights reserved.
//

#import "HeaderTableViewCell.h"
#define StringArray @[@"",@"",@"",@""]
//#define TitleArray @[@"每日签到",@"我要充值",@"我要投资",@"我要借款"]
#define TitleArray @[@"每日签到",@"我要投资",@"我要借款",@"我要充值"]
#define ImageArray @[@"classify1",@"classify3",@"classify4",@"classify2"]
#define NORMHEIGHT [[UIScreen mainScreen] bounds].size.height / 736
@implementation HeaderTableViewCell
static int i ;
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier

{
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        _backView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, Screen_Width, 12 + Screen_Width/4)];
        [self.contentView addSubview:_backView];
        
        
        for (i = 0; i < 4; i++) {
            
            UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
            btn.tag = 1000+i;
            btn.frame = CGRectMake(30 +(20 + (Screen_Width/4 -30)) * i, 15, Screen_Width/4 - 30 *NORMHEIGHT, Screen_Width/4 - 45 *NORMHEIGHT);
            [btn addTarget:self action:@selector(clickBtn:) forControlEvents:UIControlEventTouchUpInside];
            [btn setBackgroundImage:[UIImage imageNamed:ImageArray[i]] forState:UIControlStateNormal];
            
            UILabel *lable = [[UILabel alloc] initWithFrame:CGRectMake(30 +(20 + (Screen_Width/4 -30)) * i, 10 +Screen_Width/4-60*NORMHEIGHT, Screen_Width/4 - 30, Screen_Width/4 - 30)];
            [self.contentView addSubview:lable];
            lable.text = TitleArray[i];
            lable.adjustsFontSizeToFitWidth = YES;
            [self.contentView addSubview:btn];
            
            UIView *backView = [[UIView alloc] initWithFrame:CGRectMake(0, 10 + Screen_Width/4, Screen_Width, 8)];
            backView.backgroundColor = [UIColor colorWithRed:0.95 green:0.95 blue:0.95 alpha:1.00];
            [self.contentView addSubview:backView];
            backView.alpha = 0.5;
        }
        
        
    }
    
    return self;
}



- (void)clickBtn:(UIButton *)button{
    
    _Clicked(button.tag);
    
}



@end
